package database

import (
	"fake-handwriting-server/model"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
)

func GetDatabase() *gorm.DB {
	db, err := gorm.Open(sqlite.Open("sqlite3.database"), &gorm.Config{})
	if err != nil {
		panic("failed to connect database")
		return nil
	}
	db.AutoMigrate(&model.User{})
	db.AutoMigrate(&model.File{})
	return db
}
